#include <stdio.h>

/*
 求出两个整型数的最大值
 a > b ? a : b;
 !!!!!!!宏的参数必须有括号
 */
#define MAX2NUM(a, b) 	(a) > (b) ? (a) : (b)

#define SQUARE(x)	(x) * (x)

// 两个数的交换
// typeof(a) 获取变量a的类型 a如果是int类型 typeof(a)==int a如果是float typeof(a)==float
#define SWAP(a, b) \
	do {\
		typeof(a) t; \
		t = (a);\
		(a) = (b);\
		(b) = t;\
	}while(0)

// 闰年一年有多少秒 (表达大整数注意加单位 ul是计算中所能表达整型数最大值)
#define YEAR_HOURS (366 * 24 * 60 * 60UL)

int main(void)
{
	int n1, n2;	

	n1 = 10, n2 = 5;

	printf("%d\n", MAX2NUM(n1, n2));

	printf("%d\n", SQUARE(n1 + 1));

	SWAP(n1, n2);
	printf("n1:%d, n2:%d\n", n1, n2);

	printf("%ld\n", YEAR_HOURS);

	return 0;
}

